<?php
global $USER_SETTING, $VALUTA;
?>
<h1>Ближайшие разморозки</h1>

<script language="javascript" src='<?=config_item('js_path')?>js/table_list.js?<?=time()?>'></script>

<a href='#' onclick="openFilter(); return false;"><img src='<?=config_item('image_path')?>images/icons/funnel.png' width='16' height='16' title='' align=left style="margin-right:5px;"> Фильтр</a> <br><br>
<form method=get action='' enctype='multipart/form-data' id='filter' style='display:none;'>
<table class='edit' cellspacing=0 style="width:100%">
<tr>
	<td>Показывать:</td>
	<td width=100%>
		<select name='show_on'>
			<option value='week' <?php if($filter['show_on'] == 'week') echo "selected"; ?>>На ближайшую неделю</option>
			<option value='1month' <?php if($filter['show_on'] == '1month') echo "selected"; ?>>На ближайший месяц</option>
			<option value='2month' <?php if($filter['show_on'] == '2month') echo "selected"; ?>>На ближайшие 2 месяца</option>
			<option value='3month' <?php if($filter['show_on'] == '3month') echo "selected"; ?>>На ближайшие 3 месяца</option>
			<option value='all' <?php if($filter['show_on'] == 'all') echo "selected"; ?>>За всё время</option>
		</select>
	</td>
</tr>
<tr>
	<td valign=top>Включать:</td>
	<td>
		<label><input type='checkbox' name='type_inc[]' value='nodepo' <?php if(in_array('nodepo', $filter['type_inc'])) echo "checked"; ?>> Вклады на базовые мавро</label>
		<label><input type='checkbox' name='type_inc[]' value='ref' <?php if(in_array('ref', $filter['type_inc'])) echo "checked"; ?>> Реферальные бонусы</label>
		<label><input type='checkbox' name='type_inc[]' value='l' <?php if(in_array('l', $filter['type_inc'])) echo "checked"; ?>> Бонусы руководителя</label>
		<label><input type='checkbox' name='type_inc[]' value='reg' <?php if(in_array('reg', $filter['type_inc'])) echo "checked"; ?>> Бонусы за регистрацию</label>
		<label><input type='checkbox' name='type_inc[]' value='my' <?php if(in_array('my', $filter['type_inc'])) echo "checked"; ?>> Собственные вклады</label>
	</td>
</tr>

</table>
<br>
<input type='submit' value='Применить'>
</form>

<table class='list operations' cellpadding=0 cellspacing=0>
	<thead>
		<tr>
			<th>Участник</th>
			<th>Срок разморозки</th>
			<th>Сумма при разморозке</th>
			<th>Дата вклада</th>
			<th>Сумма вклада</th>
			<th>Курс</th>
			<th>Мавро</th>
			<th>Вид и место хранения средств</th>
			<th>Дополнительно</th>
		</tr>
	</thead>
	<tbody>
	<?php
	foreach($operations as $oper) 
	{
		$type_class = isBuy($oper) ? 'buy' : 'sell';
		$is_bonus = $oper['bonus'] && $oper['type'] != 'modify.buy' && $oper['type'] != 'modify.sell';
		$super = $oper['depo'] && substr($oper['percent'], -1) == 5 ? "super" : '';
		$frozen_gray = $oper['frozen_date'] && $oper['frozen_date'] < date('Y-m-d') ? 'gray' : '';
		?>
		<tr user_id="<?=$oper['user_id']?>" unitId='<?=$oper['id']?>'>
			<td style='text-align:left'><a href='oper/?u[]=<?=$oper['user_id']?>'><?=$oper['user_fio']?> (<?=$oper['user_email']?>)</a></td>
			<td class='<?=($is_bonus ? 'bonus' : '').' '.$frozen_gray?>'><?=getPrintDate($oper['frozen_date'])?></td>
			<td class='<?=($is_bonus ? 'bonus' : '').' '.$frozen_gray?>'><?=(number_format($oper['frozen_summ'], 2, $USER_SETTING['znak_drob'], ' ')).' '.$VALUTA[$oper['mavro_valuta']] ?></td>
			<td class='<?=$is_bonus ? 'bonus' : ''?> o_date'><?=getPrintDate($oper['date'])?></td>
			<td class='<?=$is_bonus ? 'bonus' : ''?> <?=$type_class?> o_summ'><?=number_format($oper['summ'], 2, $USER_SETTING['znak_drob'], ' ')?> <?=$VALUTA[$oper['valuta']]?></td>
			<td class='<?=$is_bonus ? 'bonus' : ''?> <?=$type_class?> o_kurs'><?php if($oper['kurs_valuta'] > 0 && $oper['kurs_valuta'] != 1) echo $oper['kurs_valuta']." / "; ?><?php if($oper['type'] != 'week' && $oper['mavro'] > 0) { ?> <?=$oper['kurs']?> (<?=$oper['percent']?>%)<?php } else { ?><?=$oper['percent']?>%<?php } ?></td>
			<td class='<?=$is_bonus ? 'bonus' : ''?> <?=$type_class?> o_mavro'><?php if($oper['type'] != 'week' && $oper['mavro'] > 0) { ?><?php if(isBuy($oper) && $oper['ostatok'] && $oper['ostatok'] != $oper['mavro']) {?><span class='ostatok'><?=$oper['ostatok']?> <?=$oper['mavro_valuta']?></span><?php } ?><?=$oper['mavro']?> <?=$oper['mavro_valuta']?> <?php if($oper['depo']) echo "(".$oper['depo']."m ".$super.")";?><?php } ?></td>
			<td class='<?=$is_bonus ? 'bonus' : ''?> o_hranen'><?=$oper['hranen']?></td>
			<td class='o_dop'><?=$oper['dop']?></td>
		</tr>
	<?php  } ?>
</tbody>
</table>
